/**
 * 装饰器 
 * 
 */ 
export {}

// namespace b{
    function addNameEat(constructor:Function){
        constructor.prototype.name= 'hahah'
        constructor.prototype.eat = function(){}
    }
    
    @addNameEat
    class Person{
        name:string
        eat: () => void
        constructor(){}   
    }
    let p:Person = new Person()
    console.log(p.name)
    p.eat()
// }


// 类装饰器工厂
namespace c{
    function addNameEatFactory(name:string){
        return function addNameEat(x:Function){
            x.prototype.name = name
            x.prototype.eat = function () {}
        }
    }
    @addNameEatFactory('增加')
    class Person {
        name: string
        eat: Function
        constructor() {}
    }
    let p: Person = new Person()
    console.log(p.name)
    // p.eat()
}

